import lvgl as lv

LCD_H = lv.scr_act().get_height()#854
LCD_W = lv.scr_act().get_width()#480

# Create a Tab view object
tabview = lv.tabview(lv.scr_act(), lv.DIR.BOTTOM, 60)

tabview.set_size(LCD_W, LCD_H)
#tabview.set_style_bg_opa(0, lv.PART.MAIN) #lv.OPA.TRANSP 背景透明

# Add 3 tabs (the tabs are page (lv_page) and can be scrolled
tab1 = tabview.add_tab("1")
tab2 = tabview.add_tab("2")
tab3 = tabview.add_tab("3")

# Add content to the tabs
label = lv.label(tab1)
label.set_text("""This the first tab

If the content
of a tab
becomes too
longer
than the
container
then it
automatically
becomes
scrollable.



Can you see it?""")

label = lv.label(tab2)
label.set_text("Second tab")

label = lv.label(tab3)
label.set_text("Third tab");

label.scroll_to_view_recursive(lv.ANIM.ON)

tabview.set_act(0, lv.ANIM.ON) #聚焦到第一页

def tb_change_event(event):
    print("tabview.get_tab_act():",tabview.get_tab_act())

tabview.add_event_cb(tb_change_event, lv.EVENT.VALUE_CHANGED, None)


#tabview.get_content().clear_flag(lv.obj.FLAG.SCROLLABLE) #禁止滑动